package com.demo.local;

import java.time.DayOfWeek;
import java.time.LocalDate;
import java.time.Month;
import java.time.temporal.ChronoField;

public class TestLocalDate {
    public static void main(String[] args) {
        LocalDate date = LocalDate.of(2017, 12, 29);
//        int year = date.getYear();
        int year = date.get(ChronoField.YEAR);
        System.out.println("year: " + year);

        Month month = date.getMonth();
        System.out.println("month: " + month.name());

        int day = date.getDayOfMonth();
        System.out.println("day: " + day);

        DayOfWeek dow = date.getDayOfWeek();
        System.out.println("day of week: " + dow.name());

        boolean leap = date.isLeapYear();
        System.out.println("is leap year? " + leap);

        int len = date.lengthOfMonth();
        System.out.println("length of month: " + len);
    }
}
